Integration Guide Estun BPS 1.12

This guide describes how to integrate Estun robots with Bin Picking Studio (BPS) 1.12.

For the general concept of the communication, see the Robot communication overview. The supported versions of all Robot modules are listed in the Robot module support matrix.

1. Prerequisites

Before you start, make sure that your system meets these requirements:

  • Controller software version 1.36 or higher

  • ARM Linux CPU

  • Bin Picking Studio 1.12

This version of the Robot module was developed on an Estun Linux controller with software V1.36.C09.R10.A.

Optional: to commission the robot from a PC, install Estun Editor (version 2.7.4.1 or higher is recommended). The robot firmware and Estun Editor are free to download from the Estun support website.

To install the Robot State Server, you need a PC with an SFTP client (WinSCP, MobaXterm, etc.).

2. Robot Controller Setup

2.1 Initial Setup and Configuration

For detailed information about the Estun robot controller, see the official Estun documentation. The images below show the ERC3-C1 robot controller used in this manual:

Figure 1
Figure 2

2.2 Network Configuration

The Estun robot controller has several Ethernet ports. Ethernet 2 and Ethernet 3 are reserved for user TCP/IP socket connections. You can use either of them. This manual uses Ethernet 3 for the communication with the Photoneo vision controller.

To change the IP configuration, click Home → Advanced Set → Network.

Figure 3

Enter the IP address and the subnet mask of the robot controller. You can use the IP address of the vision controller as the gateway. This manual uses IP address 192.168.1.2 and subnet mask 255.255.255.0.

Figure 4

Click the Save button to confirm the changes.

Note

The subnet mask 255.255.255.0 is the same as a 24-bit subnet mask (/24). For other combinations, see this table: https://dnsmadeeasy.com/support/subnet

Example of a matching network configuration on the vision controller side:

  • Vision controller IPv4 address: 192.168.1.1 / 24

  • Robot controller IPv4 address: 192.168.1.2 / 24 (as configured in the previous step)

Figure 5

You can also use the Test Connection button on the Network page of the vision controller to ping the Estun robot controller.

Figure 6

Based on the result of the test (ping command), a Robot Available or Robot Unavailable message is shown. If the robot is unavailable, check the cables and the network configuration.

Figure 7

2.3 Second Network Interface for Estun Editor (optional)

We recommend that you configure a second port (in this manual, Ethernet 2) for remote access from Estun Editor on a PC. To prevent network conflicts, give this port a static IP address on a different subnet than the one used for the connection to the vision controller.

Example of a valid configuration for this port:

  • IP Address: 192.168.100.2

  • Subnet Mask: 255.255.255.0

Figure 8

Example IPv4 configuration of the PC with Estun Editor: 192.168.100.1 / 255.255.255.0

If the connection to the Estun robot fails, or if the controller data structure is not visible after the connection, close Estun Editor and start it again with the Run As Administrator option. Estun Editor should then show this structure:

Figure 9

2.4 Installing the Robot State Server

The Robot State Server is an essential component. It provides real-time robot state data for calibration and for 3D visualization. On Estun robots, the Robot State Server is a Python script named PhoStateServer.py. The shell script runpythonRobotFace.sh starts it. Both files are in the ESTUN_STATE_SERVER folder of the Photoneo Estun BPS module. To install the Robot State Server, follow these steps.

Warning

You need a PC with an SFTP client (WinSCP, MobaXterm, etc.).

Connect to the Estun robot from your PC with WinSCP, MobaXterm or another SFTP client. Use these credentials: login root, password ERC654321.

Figure 10

Copy PhoStateServer.py and runpythonRobotFace.sh from the ESTUN_STATE_SERVER folder of the Photoneo Estun module to /opt/runtime/python/sdk/libs/RobotFace/.

Set the permissions of both copied files to octal 0777.

Figure 11
Figure 12

Go to /opt/runtime/ and open the file startSys.cmd.

Figure 13

Paste the following text at the end of this file:

Figure 14
# Launch of Photoneo State Server
echo "[$(date)] Starting Estun-Photoneo's Robot State Server..." >> /var/log/photoneo_server.log
cd /opt/runtime/python/sdk/libs/RobotFace/
./runpythonRobotFace.sh > /dev/null 2>> /var/log/photoneo.log &

Reboot the Estun robot controller to apply the changes. From now on, the Robot State Server starts automatically with the controller. You do not need to start it from a robot program.

2.5 Tool TCP Setup

Bin Picking Studio works with a Tool Center Point (TCP) that is zero relative to the robot flange. On Estun robots, this is the default zero tool (nullTool). You do not need to define TCP offsets on the robot controller, because Bin Picking Studio calculates and compensates for them internally. You can still define a custom TCP if other parts of your robot program need it. This manual uses one tool, toolPhotoneo, with a Z offset of 110 mm. The tool data are in Data → Global → Tool.

Figure 15

Use the SetTool(TOOL) command whenever you need to force the correct tool frame. Calibration and capture requests always need “nullTool”. CalibAddPointRequest and CaptureRequest select it themselves before they read the flange pose. When your robot program moves to a Cartesian pose, select the real tool (for example toolPhotoneo). When you pick with the Trajectory request, the tool setting does not matter. The trajectories are joint-based and BPS compensates for the TCP.

2.6 Robot State Server and Robot Pose Visualization

When the Robot State Server is installed on the Estun controller, Bin Picking Studio automatically connects to port 11004. It reads the current joint positions and the Cartesian tool pose of the robot. The joint positions are used to show the robot. The Cartesian TCP data are needed for calibration and for all hand-eye scan requests. The image below shows the real robot pose on the Environment page:

Figure 16

When a client connects, the Robot State Server first sends the brand ID ESTUN/1.12.0XXXXXXXXXXXX. Then it streams robot data in a loop at approximately 30 Hz. The messages alternate between:

  • joint positions (axes 1-6, in radians)

  • Cartesian flange position (X, Y, Z in mm and A, B, C in radians)

Each of the two values is therefore updated approximately 15 times per second. If the controller cannot provide the data, the server sends zeros. The robot pose on the Environment page and the calibration should now work.

To check that the correct zero tool pose is reported, start the calibration, switch from the Texture tab to the Verification tab and enable Tool Pose (robot controller) in the Axis menu. The frame marker should be in the center of the flange, with the Z axis pointing down. It should be identical to the Tool0 (robot model) frame.

Figure 17

2.7 Importing the Bin Picking Studio Module

The Photoneo Estun BPS module (Photoneo_BPS_Module_1_12_0.zip) contains:

  • ESTUN_BPS_1_12.er - the Estun project: global project variables (prjglobal.erd, array_global.erd), request programs, bin picking procedures and example programs (each program is an .erp file with its local variables in the matching .erd file)

  • ESTUN_STATE_SERVER - PhoStateServer.py and runpythonRobotFace.sh (see section 2.4)

  • README, CHANGELOG, this integration guide (PDF) and a cheat sheet (PDF)

The default way to import the Photoneo Estun BPS module to the robot is with a USB flash drive.

First, copy the ESTUN_BPS_1_12.er folder to your USB drive. On the Estun teach pendant, go to the Project menu, scroll down the sidebar and select the Loader button. The file transfer window opens.

Figure 18

Select the ESTUN_BPS_1_12.er folder on the USB drive and click the Transfer button to start the copy. All files in the folder are copied to the Estun robot controller.

Figure 19

If there are no errors, you can load the ESTUN_BPS_1_12 project directly.

Figure 20

After loading, the status of the project in the Project List is “loaded”. To run a program, select it in Playback mode and click “PC” so that it starts from the first line. A program configured with the “self-start” function loads automatically when the user enables the remote mode.

Figure 21

After the import, create the global variables listed at the end of section 3.2. They are not part of the project.

After the import, you can synchronize Estun Editor with the robot controller and edit the programs on the PC. Note that, as of April 2026, Estun Editor has some limitations: not all commands can be added or modified correctly in Estun Editor. If a command causes problems, comment out the line and create it again on the teach pendant.

Figure 22

3. Robot Module

Note

We strongly recommend that you read the Photoneo robotic API before this section.

3.1 Connection to Photoneo Vision Controller

Note

Each main program connects to the Action Request Server on the vision controller when it starts. Three project variables are important for this step:

  • PHOTONEO_IP - IP address of the vision controller port (default 192.168.1.1)

  • PHOTONEO_PORT - Port number of the Action Request Server (default 11003)

  • ESTUN_ID - STRING robot identifier (brand ID) ESTUN/1.12.0XXXXXXXXXXXX [DO NOT CHANGE]

Figure 23

In the project STRING variables, set PHOTONEO_IP to the IP address of your vision controller. In this manual, it is 192.168.1.1.

Figure 24

The main program opens the connection with SocketCreate on the socket PhotoneoSocket and sends ESTUN_ID with SocketSendStr. The connection stays open until the program closes it with SocketClose at the label prog_end.

The Estun module uses a text protocol. The robot sends every request as one line of numbers separated by spaces. The vision controller answers with comma-separated lines (header, sub-header, data). The robot confirms every received line with ACK.

You can send requests to the vision controller only after the connection is established. When the program on the Estun controller starts and connects, the Deployment page shows green Connected indicators (see the image below):

Figure 25

3.2 Request List

This section describes the API calls of the Robot module. Use these procedures for high-level control of the bin picking application. Each procedure is a program in the ESTUN_BPS_1_12 project. Start it with CALL <Program Name>. Set the input variables before the call. The p. prefix marks project variables (prjglobal.erd) and g. marks global variables. For details about each request, see Action requests.

Note

These procedures are part of the communication backend. Do not edit them.

Request

ID

Program Name

Input

Populates

Initialize

4

InitializeRequest

p.VS_ID (1-4) (also uses p.START_POS_VSx and p.END_POS_VSx project poses for the selected VS)

p.ERROR_DATA

Scan

1

ScanRequest

p.VS_ID

p.ERROR_DATA

Capture (Trigger scan)

28

CaptureRequest

p.VS_ID (current flange pose read at call time with nullTool)

p.ERROR_DATA

Reuse Scan (Localize on the last scan)

29

ReuseScanRequest

p.VS_ID

p.ERROR_DATA

Trajectory

2

TrajectoryRequest

p.VS_ID

p.ERROR_DATA, g.PHOTONEO_TRAJ[] (waypoints), p.TOTAL_TRAJ_WPT_CNT, p.TRAJ_SEG_START_IDX[], p.OPER_ORDER[], p.OPER_CNT, g.GRIPPER_OPER_ARR[] (gripper operations), Info data (section 3.5)

Pick

-

PickRequest

Uses the trajectory data stored by TrajectoryRequest

None (moves the robot)

Get Vision System Status

21

GetStatusRequest

p.VS_ID

p.ERROR_DATA, p.INFO_NUM_LOC, p.INFO_NUM_PICKABLE, p.INFO_VS_STATUS

Change Solution

9

ChangeSolRequest

p.SOL_ID

p.ERROR_DATA

Start Solution

10

StartSolRequest

p.SOL_ID

p.ERROR_DATA

Stop Solution

11

StopSolRequest

None

p.ERROR_DATA

Get Running Solution

12

GetRunningSolRequest

None

p.ERROR_DATA, p.INFO_RUNN_SOL

Change Bounding Box

32

ChangeBBoxRequest

p.VS_ID, p.BBOX_ID

p.ERROR_DATA

Change Environment (Change scene state)

15

ChangeEnvRequest

p.ENV_ID

p.ERROR_DATA

Calibration Start

25

StartCalibRequest

p.SOL_ID, p.VS_ID

p.ERROR_DATA

Calibration Add Point

5

CalibAddPointRequest

None (current flange pose read at call time with nullTool)

p.ERROR_DATA

Calibration Save

27

SaveCalibRequest

None

p.ERROR_DATA, p.INFO_CALIB_ACC

Calibration Stop

26

StopCalibRequest

None

p.ERROR_DATA

Com Check

100

ComCheckRequest

None

p.ERROR_DATA

TrajectoryRequest5Wp is an alternative version of the Trajectory request kept in the project for testing. It is not used by any example program. Always use TrajectoryRequest.

Note

The Estun BPS module uses several global variables that are not copied during the import. This prevents overwriting existing configurations on customer robots. Add the following variables to the global variable list:

  • g.PHOTONEO_TRAJ (APOSARRAY[1000]) - trajectory waypoints

  • g.GRIPPER_OPER_ARR (INT ARRAY[10]) - gripper operations of the trajectory

  • g.pPhotoneo (PAYLOAD) - payload of your gripper, set by PhoCalibration

  • g.ventil (DO) - gripper output, reset by PhoCalibration

3.3 Bin Picking Procedures

The PickRequest program starts the bin picking motion. It controls the execution of the bin picking trajectory operations. The table below gives an overview of the bin picking procedures in the ESTUN_BPS_1_12 project.

Program

Description

PickRequest

Description: Controls the execution of the bin picking trajectory operations. Goes through the OPER_ORDER array (OPER_CNT entries) and calls the trajectory or gripper execution routine for each operation. Sets the first and last waypoint of each segment (TRAJ_SEG_FIRST / TRAJ_SEG_LAST) from the segment lengths stored by TrajectoryRequest. For each gripper operation, copies the next command from g.GRIPPER_OPER_ARR to EXE_GRIPPER_OP and calls ExecuteGripperCmd.

ExecuteTrajSegCnt

Description: Continuous trajectory execution. Runs through all trajectory waypoints in a FOR loop with the MovJ command (B="RELATIVE") and does not stop at the last point (continuous motion). You can change the MovJ arguments to fine-tune the smoothness of the motion.

ExecuteTrajSegFine

Description: Trajectory execution that stops at the last point of the trajectory (fine positioning, B="ABSOLUTE"). Runs through all trajectory waypoints in a FOR loop with the MovJ command. You can change the MovJ arguments to fine-tune the smoothness of the motion.

ExecuteTrajSeg

Description: Same as ExecuteTrajSegFine. Not called by PickRequest. You can use it to execute one trajectory segment from your own program.

ExecuteGripperCmd

Description: Executes a gripper command. Calls the gripper program that matches the gripper command from the trajectory (EXE_GRIPPER_OP): 1 = GripperAttach, 2 = GripperDetach, 3 = GripperUser1, 4 = GripperUser2, 5 = GripperUser3

GripperAttach

Description: Empty placeholder for the Gripper Attach function. Add the gripper commands for your application.

GripperDetach

Description: Empty placeholder for the Gripper Detach function. Add the gripper commands for your application.

GripperUser1

Description: Empty placeholder for a gripper user function. Add the gripper commands for your application.

GripperUser2

Description: Empty placeholder for a gripper user function. Add the gripper commands for your application.

GripperUser3

Description: Empty placeholder for a gripper user function. Add the gripper commands for your application.

3.4 Bin Picking Speed and Blending Settings

Bin Picking Studio supports up to 10 trajectory segments in one bin picking trajectory. The default number of segments is 4. If needed, you can add more segments on the Grasping method page of the BPS solution.

Figure 26

To adjust the speed and smoothness of the robot for a specific segment, change the MOVJ arguments on line 6, as shown in the image above. WaitFinish is an important step in this execution loop. It lets the Estun motion interpolator look ahead to the next MOVJ instruction while the current MOVJ is still running. On the ER7-910-MS-CE, the best results were with the 30% setting. The best value depends on the density of the trajectories and on the robot size.

Figure 27

3.5 Info data

Info data are additional values sent with some responses (see Info data). The module stores each value in its own INT project variable, in the unit in which it was sent (no conversion). A variable keeps its value until the next response that contains the same key. The module also copies the raw values to INFO_DATA_ARR[] in the order of arrival.

Key

Info data

Variable

Unit in robot

Filled by

1

Tool point invariance

INFO_TOOL_INV

index

TrajectoryRequest

2

Gripping point ID

INFO_GP_ID

index

TrajectoryRequest

3

Gripping point invariance

INFO_GP_INV

index

TrajectoryRequest

4

Dimension X

INFO_OBJ_DIM_X

mm

TrajectoryRequest

5

Dimension Y

INFO_OBJ_DIM_Y

mm

TrajectoryRequest

6

Rotation Z

INFO_OBJ_ROT_Z

mrad

TrajectoryRequest

7

Neural network label

INFO_NN_LABEL

integer

TrajectoryRequest

8

Max Z height

INFO_LAYER_MAX_Z

mm

reserved (not sent by BPS)

9

Tilt

INFO_LAYER_TILT

mrad

reserved (not sent by BPS)

10

Calibration accuracy

INFO_CALIB_ACC

µm

SaveCalibRequest

11

Running solution ID

INFO_RUNN_SOL

integer

GetRunningSolRequest

12

Number of localized objects

INFO_NUM_LOC

integer

GetStatusRequest

13

Number of ready objects

INFO_NUM_PICKABLE

integer

GetStatusRequest

14

Processing state

INFO_VS_STATUS

0 / 1

GetStatusRequest

The key numbers are stored in the constants CONST_INFO_* in prjglobal.erd. Do not change them.

3.6 Variables used by the module

All variables below are project variables in prjglobal.erd unless marked as global (g.).

Variable

Type

Description

PHOTONEO_IP

STRING

IP address of the vision controller. Default 192.168.1.1.

PHOTONEO_PORT

INT

Port of the Action Request Server. Default 11003.

ESTUN_ID

STRING

Brand ID ESTUN/1.12.0XXXXXXXXXXXX. Do not change.

PhotoneoSocket

Socket

Socket used for the connection (Socket0).

VS_ID

INT

Vision system ID (1-4) for the next request.

SOL_ID

INT

Solution ID for Change / Start Solution and Calibration Start.

BBOX_ID

INT

Bounding box ID for ChangeBBoxRequest.

ENV_ID

INT

Environment (scene state) ID for ChangeEnvRequest.

START_POS_VS1 - START_POS_VS4

APOS

Start pose of the trajectory for each vision system, sent by InitializeRequest.

END_POS_VS1 - END_POS_VS4

APOS

End pose of the trajectory for each vision system, sent by InitializeRequest.

SCAN

APOS

Scanning pose used by the example programs.

ERROR_DATA

INT

Error code of the last request. 0 = no error.

INFO_*

INT

Info data, see section 3.5.

g.PHOTONEO_TRAJ[]

APOS array (global)

All waypoints of the last trajectory, in degrees.

TOTAL_TRAJ_WPT_CNT

INT

Number of waypoints in g.PHOTONEO_TRAJ[].

TRAJ_SEG_START_IDX[]

INT array

Index of the first / last waypoint of each trajectory segment.

OPER_ORDER[], OPER_CNT

INT array, INT

Order and number of operations of the trajectory (0 = continuous segment, 1 = fine segment, 2 = gripper operation).

g.GRIPPER_OPER_ARR[]

INT array (global)

Gripper commands of the trajectory in order of execution.

EXE_GRIPPER_OP

INT

Gripper command currently executed by ExecuteGripperCmd.

CONST_*

INT

Request IDs, Info data keys and gripper command numbers. Do not change.

Other variables in prjglobal.erd (MSG_*, ITERATOR*, WPT_*, FLANGE_*, …) are used internally by the request programs.

3.7 Error codes

The module does not define named error constants. Every request writes the error code from the vision controller to ERROR_DATA (0 = no error). For the meaning of each code, see Error codes. Examples: 201 (path planning failed), 222 (invalid bounding box) and 467 (calibration accuracy above the allowed threshold).

The module and the example programs raise the following robot alarms with SetRtToErr:

Alarm ID

Message

Raised by

90001

Wrong Request ID / Wrong Operation Type

Request programs, when the response does not belong to the request that was sent

91001

Scan Error, Change Sol Error, Change BBox Error, Change Env Error

Example programs, when ERROR_DATA is not 0 after Scan, Capture, Trajectory or a change request

91004

Init Error, Robot Disconnected

Example programs, when Initialize or Com Check fails

92001

Adding Calib Point Failed

PhoCalibration, when CalibAddPointRequest fails

3.8 Example Programs

The Photoneo Estun module contains several example programs. They show how to use the requests from section 3.2 in different use cases:

Program Example

Description

PhoMainBasic

Description: The basic bin picking main program. Shows the complete workflow for an Estun robot. Program flow:

  1. Moves to the scanning pose

  2. Opens a socket connection to the vision controller and sends the Estun brand ID

  3. Sends an Initialize request (VS_ID = 1) to register the Start and End poses of the robot

  4. Enters the main loop: Scan -> Trajectory -> Pick -> Place (local poses P0 / P1)

Error handling: Each step checks ERROR_DATA.value. On error, the program raises an alarm and jumps to prog_end, where the socket is closed. Note: Before you run the program, teach the SCAN pose, the START_POS_VS1/END_POS_VS1 poses and the drop-off poses.

PhoCalibration

Description: The calibration main program for an Estun robot. Program flow: Goes through 9 calibration poses:

  1. Sets the payload (g.pPhotoneo) and resets the gripper output (g.ventil)

  2. Moves to the SCAN position

  3. Opens the socket connection to the vision controller

  4. Moves to CALIB_POSE_1 through CALIB_POSE_9 in sequence and calls CalibAddPointRequest at each position

  5. Moves back to the SCAN position

Error Handling: If CalibAddPointRequest fails, the program raises an error (eid=92001) and jumps to prog_end. Note: For fully automatic recalibration, add StartCalibRequest before the first point and SaveCalibRequest / StopCalibRequest after the last point (see section 4.3).

PhoMainMultiVS

Description: Bin picking main program for a setup with two vision systems. Alternates between VS1 and VS2 in each cycle. Program Flow: Initialize VS1, Initialize VS2 -> set VS_ID=1 -> loop: Scan (using current VS_ID) -> Trajectory -> Pick -> Place -> toggle VS_ID (1<->2) -> repeat. Note: Teach SCAN, START_POS_VS1/END_POS_VS1, START_POS_VS2/END_POS_VS2 and the drop-off poses (P0, P1).

PhoMainChangeBBox

Description: Bin picking main program that changes the active bounding box after each pick cycle. Shows how to switch bounding boxes in one running program. Program Flow: Initialize (VS_ID=1, BBOX_ID=1) -> loop: Scan -> Trajectory -> Pick -> Place -> ChangeBBox (toggles between ID 1 and 2) -> repeat. Note: Teach SCAN, START_POS_VS1/END_POS_VS1 and the drop-off poses (P0, P1). The solution must have two valid bounding boxes.

PhoMainChangeSol

Description: Same workflow as PhoMainBasic, with solution management.

  • p.SOL_ID is set to 12 at the start. After each pick cycle, the program toggles p.SOL_ID between 12 and 13 and calls ChangeSolRequest to switch the active solution on the vision controller. Replace 12 and 13 with the IDs of your solutions.

  • After each solution change, the program jumps back to init and sends the Initialize request again, because the new solution needs its own Start and End poses.

  • To find out which solution is running, call GetRunningSolRequest - the ID is stored in p.INFO_RUNN_SOL.

Error handling: Included for ChangeSolRequest. On failure, SetRtToErr is raised and execution jumps to prog_end.

PhoMainChangeEnv

Description: Bin picking main program that changes the active environment scene after each pick cycle. Program Flow: Initialize (VS_ID=1) -> loop: Scan -> Trajectory -> Pick -> Place -> ChangeEnv (toggles ENV_ID between 1 and 2) -> re-Initialize -> repeat. Re-initialization: Required after each environment change, because the new scene can have a different scan configuration. Note: Teach SCAN, START_POS_VS1/END_POS_VS1 and the drop-off poses (P0, P1). The solution must have two valid environment scenes.

PhoMainGetStatus

Description: Bin picking main program that calls GetStatusRequest several times between Scan and Trajectory to monitor the localization progress. Shows how to use GetStatusRequest to check INFO_NUM_LOC / INFO_NUM_PICKABLE / INFO_VS_STATUS before you request a trajectory. Program Flow: Initialize (VS_ID=1) -> loop: Scan -> GetStatus x5 (500 ms apart) -> Trajectory -> Pick -> Place -> repeat. Note: Teach SCAN, START_POS_VS1/END_POS_VS1 and the drop-off poses (P0, P1).

PhoMainMeshingStatic

Description: Bin picking main program for the Static Meshing (multi-view capture) workflow. Program Flow: Initialize (VS_ID=1) -> loop: move to MESH01 -> CaptureRequest -> MESH02 -> CaptureRequest -> MESH03 -> CaptureRequest -> ScanRequest (triggers localization) -> Trajectory -> Pick -> Place -> repeat. CaptureRequest sends the current Cartesian flange pose with each capture. ScanRequest starts the final localization after all captures. Note: Teach SCAN, START_POS_VS1/END_POS_VS1, the three MESH0x poses and the drop-off poses (P0, P1). A Static Meshing solution in BPS is required.

PhoMainReuseScan

Description: Bin picking main program for a setup with two vision systems. VS1 performs a full scan and VS2 reuses the last scan result. Shows how ReuseScanRequest can shorten the cycle time when two areas share similar scene data. Program Flow: Initialize VS1, Initialize VS2 -> set VS_ID=1 -> loop: if VS_ID=1 call ScanRequest, else call ReuseScanRequest -> Trajectory -> Pick -> Place -> toggle VS_ID (1<->2) -> repeat. Note: Teach SCAN, START_POS_VS1/END_POS_VS1, START_POS_VS2/END_POS_VS2 and the drop-off poses (P0, P1).

PhoMainComCheck

Description: Bin picking main program with Communication Check calls at key points to verify that the connection is alive. Useful to detect network dropouts during the cycle. Raises error eid=91004 (‘Robot Disconnected’) if ComCheck fails. Program Flow: Connect -> ComCheck -> Initialize (VS_ID=1) -> ComCheck -> loop: Scan -> ComCheck -> Trajectory -> Pick -> Place -> repeat. Note: Teach SCAN, START_POS_VS1/END_POS_VS1 and the drop-off poses (P0, P1).

Listing of PhoMainBasic.erp:

Start:
--SetDO(g:ventil,0)
--Move to scanning pose
MovJ{P=t_p.SCAN,V=t_s.V300}
---
--Establish Connection to Vision Controller
---
SocketCreate{socketName=t_p.PhotoneoSocket,IP=t_p.PHOTONEO_IP.value,Port=t_p.PHOTONEO_PORT.value,Ret=t_p.SOCKET_RETVAL}
SocketSendStr{socketName=t_p.PhotoneoSocket,stringData=t_p.ESTUN_ID,Ret=t_p.SOCKET_RETVAL}
Wait{T=10}
---
--Initialize Request
---
t_p.VS_ID.value = 1
CALL InitializeRequest
--If init fails, go to program end
IF ( t_p.ERROR_DATA.value ~= 0 ) THEN
    SetRtToErr{msg="Init Error",eid=91004}
    GOTO prog_end
ENDIF
---
--Scan Request
---
scan:
Wait{T=1000}
t_p.VS_ID.value = 1
t_p.ERROR_DATA.value = 0
CALL ScanRequest
--If scan fails, go to program end
IF ( t_p.ERROR_DATA.value ~= 0 ) THEN
    SetRtToErr{msg="Scan Error",eid=91001}
    GOTO prog_end
ENDIF
---
--Trajectory Request
---
traj:
CALL TrajectoryRequest
IF ( t_p.ERROR_DATA.value ~= 0 ) THEN
    SetRtToErr{msg="Scan Error",eid=91001}
    GOTO prog_end
ENDIF
---
--Pick Request
---
CALL PickRequest
---
--Placing
---
MovL{P=t_l.P0,V=t_s.V300,B="FINE"}
MovL{P=t_l.P1,V=t_s.V300,B="FINE"}
--SetDO(g:ventil,0)
MovL{P=t_l.P0,V=t_s.V300}
---
--Jump back to scan label
GOTO scan
---
prog_end:
SocketResetBuf{socketName=t_p.PhotoneoSocket}
SocketClose{socketName=t_p.PhotoneoSocket,Ret=t_p.SOCKET_RETVAL}
End;

4. Runtime

When the solution is fully configured on the vision controller, finish the remaining steps on the robot side and run the bin picking program.

4.1 Teach Positions

After you load the ESTUN_BPS_1_12 project or another example program, touch up a few poses before you run the program. See the APOS declarations below:

Figure 28

For a basic solution with one vision system, modify 3 poses: SCAN, START_POS_VS1 and END_POS_VS1. START_POS_VS1 and END_POS_VS1 are the most important. They define the first and the last trajectory waypoint, and the Initialize request needs them for each vision system. Usually, the Start and End poses are taught with the robot tool above the center of the bin. For static sensors, teach the SCAN pose outside the scanning volume, so that the robot is not under the sensor during the scan.

These three poses are in Data → PROJECT → APOS. To modify a pose, jog the robot to the required pose and press the Modify and Teach button on the teach pendant. The new joint values are stored in the APOS variable.

Note

The placing part of the program also contains local poses. Touch them up too.

4.2 Gripper Commands

The gripper procedures are in the ESTUN_BPS_1_12 project and are empty by default. Add the IO commands for your gripper operations.

Figure 29

On the Grasping Methods page of Bin Picking Studio, you can set a gripper command for each major waypoint of the bin picking trajectory. For example, if the Attach procedure is set at the Grasp waypoint, PickRequest calls ExecuteGripperCmd when the robot reaches the Grasp waypoint. ExecuteGripperCmd then calls the GripperAttach program.

Figure 30

4.3 Calibration

Bin Picking Studio has 2 calibration methods:

  • Sphere-based calibration - for statically mounted sensors

  • Marker-pattern-based calibration - for robot-mounted (hand-eye) sensors

For both methods, capture the calibration object from 9 poses with enough variation in the tool pose. Always use nullTool as the default frame. A non-zero tool or user frame can give wrong calibration results.

You can also calibrate without the calibration procedures of the Estun module. Start the calibration in BPS, jog the robot from point to point and add the points manually in BPS. For production setups where recalibration is expected, we recommend that you store the calibration points in the program and make sure that the motion between these poses is collision-free.

The Estun module contains the PhoCalibration example program:

  1. Start - start the calibration in BPS (semi-automatic) or call StartCalibRequest with SOL_ID and VS_ID (fully automatic).

  2. Add points - PhoCalibration moves to CALIB_POSE_1 … CALIB_POSE_9 (local APOS variables of PhoCalibration - teach them first) and calls CalibAddPointRequest in each pose. The request reads the current flange pose with nullTool and sends it to the vision controller.

  3. Save - save the calibration in BPS or call SaveCalibRequest. The calibration accuracy is stored in INFO_CALIB_ACC (µm).

  4. Stop - stop the calibration in BPS or call StopCalibRequest.

By default, PhoCalibration only adds the points. For fully automatic recalibration, add the Start / Save / Stop calls (with the correct vision system and solution IDs). The recalibration then needs no manual steps on the vision system.

Figure 31

In general, the calibration error should be below 3 mm. On the Verification tab, check that the point cloud matches the robot body and the gripper exactly. Investigate any difference, because it can cause a collision. The most common causes are wrong tool frame values, wrong gripper model orientation, wrong robot model, encoder zeroing and an unstable robot base.

4.4 Runtime Prerequisites

Do a final check before you start the bin picking program on the robot.

Make sure that:

  • The bin picking solution is correctly configured on the vision controller.

  • The network setup on the robot side is complete and the Robot State Server works.

  • The global variables from section 3.2 are created.

  • All vision systems in the solution are calibrated.

  • The Start and End poses of all vision systems are touched up.

  • All local poses in the main program are touched up.

  • The gripper procedures are ready and working.

4.5 Running the PhoMainBasic Program

Deploy your solution. Until the communication is established, the Deployment page shows the Action Request Client (Robot) status as DISCONNECTED.

Figure 32

Note

Before you run the program for the first time, we strongly recommend that you decrease the override speed to 10%.

Figure 33

When the connection is established, the Action Request Client and Robot State Server status changes to CONNECTED. The sensor should then capture the first scan, and the localization should start to localize objects and calculate trajectories to the first objects in the scene.

If there is a pickable object in the scene and the robot controller has received the trajectory for it, the robot should start moving towards the object.

Figure 34

If everything looks fine, let the robot continue towards the first object and check that the path is correct. If the robot stops too far from the object or pushes it too deep, make changes on the Tool Point or Gripping Point page of Bin Picking Studio.

If the trajectories look fine, set up your own placing routine and slowly increase the speed back to 100%.

Figure 35

You have successfully deployed the Photoneo Estun Robot module. You can now improve your application further. Use the cheat sheet and the example programs as a guide.

5. Troubleshooting and error handling

  • Request failed - every request writes the error code from the vision controller to ERROR_DATA. Check it after each CALL and handle the error in your program. The example programs raise an alarm and jump to prog_end, where the socket is reset and closed. See Error codes.

  • Response timeout - the request programs wait up to 15 s for the first response line of Initialize and Scan, up to 5 s for the other requests and up to 0.5 s for each following line. If the vision controller does not answer, check that the solution is deployed and that the connection on the Deployment page is green.

  • Alarm 90001 Wrong Request ID - the response does not belong to the request that was sent, usually because an earlier request was interrupted. Restart the main program. It opens a new connection.

  • No connection - check PHOTONEO_IP and PHOTONEO_PORT (11003), the network setup (section 2.2) and that only one robot program uses the socket.

  • Robot State Server disconnected - check that both files are in /opt/runtime/python/sdk/libs/RobotFace/ with permissions 0777, that startSys.cmd contains the start commands and that the controller was rebooted. Errors are written to /var/log/photoneo.log.

  • Gripper does not react - add your IO commands to GripperAttach / GripperDetach and check the gripper commands on the Grasping Methods page.

6. Version and brand ID

Item

Value

Robot module version

1.12.0 (Photoneo_BPS_Module_1_12_0.zip)

Bin Picking Studio

1.12

Brand ID (ESTUN_ID and Robot State Server)

ESTUN/1.12.0XXXXXXXXXXXX

Action Request Server port

11003

Robot State Server port

11004

7. Migration

The Estun BPS module was first released with version 1.12, so there is nothing to migrate. See Migration from BPS 1.11.x to BPS 1.12.x for the changes in the communication interface.